<?php
namespace app\erp\validate;

use think\Validate;

class Memberrule extends Validate
{

    protected $rule = [
        'username' => 'require|min:2|unique:member,username',
        'phone' => 'length:11',
        'email' => 'email'
    ];

    protected $message = [
        'username.require' => '登录账号必须填写',
        'username.min' => '登录账号最少两个汉字',
        'username.unique' => '登录账号已存在',
        'realname.min' => '真实姓名最少两个字',
        'phone.require' => '手机号不能为空',
        'phone.length' => '手机号不正确',
        'email.email' => '电子邮箱格式不正确'
    ];

    protected $scene = [
        'edit' => [
            'username' => 'min:2',
            'realname' => 'min:2',
            'phone' => 'length:11',
            'email' => 'email'
        ]
    ];
}